<?php

$moduleFolder = realpath('../application/modules' );
$modules = scandir($moduleFolder);
foreach($modules as $module)
{
	if(substr($module, 0, 1) != '.')
	{
		echo "<h2>$module</h2>";
		$tableFolder = realpath('../application/modules/' . $module . '/models/DbTable' );
		if($tableFolder)
		{
			$tables = array();
			$contents = scandir($tableFolder);
			$module = ucfirst($module);
			foreach($contents as $fileName)
			{
				$fileName = $tableFolder . '/' . $fileName;
				$pathInfo = pathinfo($fileName);
				if(is_file($fileName) /*&& $pathInfo['extension'] === 'php'*/)
				{
				?>
					<?= $pathInfo['filename']?>: <a href='<?= Zend_Controller_Front::getInstance()->getBaseUrl() ?>/<?= Zend_Controller_Front::getInstance()->getRequest()->getModuleName() ?>/<?= Zend_Controller_Front::getInstance()->getRequest()->getControllerName() ?>/list/table/<?= $module ?>_Model_DbTable_<?= $pathInfo['filename'] ?>'>list</a> - <a href='<?= Zend_Controller_Front::getInstance()->getBaseUrl() ?>/<?= Zend_Controller_Front::getInstance()->getRequest()->getModuleName() ?>/<?= Zend_Controller_Front::getInstance()->getRequest()->getControllerName() ?>/add/table/<?= $module ?>_Model_DbTable_<?= $pathInfo['filename'] ?>'>add</a><br />
				<?php
				}
			}
		}
	}
	
}


